import type { IBreadcrumb } from "@/components/breadcrumb/types"

export function menuToPath(usermenus: any[], pathurl: string, menuPathBreadcrumb: any[]) {
  for (const menu of usermenus) {
    if (menu.type === 1) {
      const findmenu = menuToPath(menu.children, pathurl, menuPathBreadcrumb)
      if (findmenu) {
        menuPathBreadcrumb.push({ name: menu.name, url: menu.url })
        menuPathBreadcrumb.push({ name: findmenu.name, url: findmenu.url })
        return menuPathBreadcrumb
      }
    } else if (menu.type === 2 && menu.url === pathurl) {
      return menu
    }
  }
}

// export { breadcrumbs }
